package main.war;

import java.io.File;

import org.bukkit.Material;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;

import main.war.listener.PlayerInteract;

public class CityWar extends JavaPlugin{
	private static FileConfiguration config;
	private File configFile;
	private static File path;
	@Override
	public void onEnable(){
		config = new YamlConfiguration();
		configFile = new File(getDataFolder(),"config.yml");
		getServer().getPluginManager().registerEvents(new PlayerInteract(new ItemStack(Material.getMaterial(config.getInt("chooseTool")))), this);
		path = this.getDataFolder();
		load();
	}
	public FileConfiguration getCityWarConfig(){
		return config;
	}
	public void load(){
		if(!configFile.exists()){
			this.saveDefaultConfig();
		}
		try {
			config.load(configFile);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	public static File getPath(){
		return path;
	}
}
